#pragma once

// --------------------------------------------------------------------------------------
//  Handy Human-readable constants for common immediate values (_16kb -> _4gb)

static const sptr _64kb		= 0x10000;
static const sptr _16kb		= _64kb / 4;
static const sptr _128kb	= _64kb * 2;
static const sptr _256kb	= _128kb * 2;

static const s64 _1mb		= 0x100000;
static const s64 _8mb		= _1mb * 8;
static const s64 _16mb		= _1mb * 16;
static const s64 _32mb		= _1mb * 32;
static const s64 _64mb		= _1mb * 64;
static const s64 _256mb		= _1mb * 256;
static const s64 _1gb		= _256mb * 4;
static const s64 _4gb		= _1gb * 4;

namespace Ps2MemSize
{
	static const uint MainRam = _32mb;		// main memory
	static const uint Rom = _1mb * 4;		// 4 mb main rom
	static const uint Rom1 = 0x00040000;	// dvd player
	static const uint Rom2 = 0x00080000;	// chinese extension
	static const uint ERom = 0x001C0000;	// dvd extension
	static const uint Hardware = _64kb;
	static const uint Scratch = _16kb;

	static const uint IopRam = _1mb * 2;	// 2mb main ram on iop
	static const uint IopHardware = _64kb;

	static const uint GSregs = 0x00002000;	// 8k for gs registers etc
}

typedef u8 mem8_t;
typedef u16 mem16_t;
typedef u32 mem32_t;
typedef u64 mem64_t;
typedef u128 mem128_t;

struct EEVM_MemoryAllocMess
{
	u8 Main[Ps2MemSize::MainRam];		// main memory (32MB)
	u8 Scratch[Ps2MemSize::Scratch];	// scratchpad!
	u8 ROM[Ps2MemSize::Rom];			// boot rom
	u8 ROM1[Ps2MemSize::Rom1];			// dvd player
	u8 ROM2[Ps2MemSize::Rom2];			// chinese
	u8 EROM[Ps2MemSize::ERom];			// dvd extensions

	// two 1MB buffers for rw to high memory (>32)
	// return 0 on read, discard write

	u8 ZeroRead[_1mb];
	u8 ZeroWrite[_1mb];
};

struct IopVM_MemoryAllocMess
{
	u8 Main[Ps2MemSize::IopRam];	// main memory (2mb)
	u8 P[_64kb];					// this is?
	u8 Sif[0x100];					// special registers (not needed?)
};

extern __pagealigned u8 eeHw[Ps2MemSize::Hardware];
extern __pagealigned u8 iopHw[Ps2MemSize::IopHardware];

extern EEVM_MemoryAllocMess* eeMem;
extern IopVM_MemoryAllocMess* iopMem;